using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_UserDetail : Admin, IRequiresSessionState
{
	private UserInfoBll _userinfo;
	private ChinaCity _city;
	protected int UserID = Fetch.GetID("UserID");
	protected ScriptManager ScriptManager1;
	protected TextBox UserIDBox;
	protected TextBox UserNameBox;
	protected TextBox TrueName;
	protected TextBox ComeFrom;
	protected TextBox Birthday;
	protected TextBox Nation;
	protected TextBox IDCard;
	protected RadioButtonList rblMarriage;
	protected DropDownList Eductation;
	protected TextBox GraduteSchool;
	protected TextBox Family;
	protected TextBox Interests;
	protected TextBox CreateTime;
	protected TextBox UpdateTime;
	protected TextBox intro;
	protected TextBox InCome;
	protected TextBox ZipCode;
	protected TextBox HomePhone;
	protected TextBox Mobile;
	protected TextBox Fax;
	protected TextBox OICQ;
	protected TextBox ICQ;
	protected TextBox MSN;
	protected TextBox HomePage;
	protected TextBox Taobaowangwang;
	protected TextBox CompanyName;
	protected TextBox BuyCrediet;
	protected TextBox SaleCrediet;
	protected Label renzheng;
	protected Label renzheng1;
	protected Label renzheng2;
	protected Label renzheng3;
	protected Label renzheng4;
	protected Label renzheng5;
	protected TextBox ShopID;
	protected Button UserDetailButton;
	protected UserInfoBll m_UserInfo
	{
		get
		{
			UserInfoBll userinfo;
			if (this._userinfo == null)
			{
				this._userinfo = new UserInfoBll(this.conn);
				userinfo = this._userinfo;
			}
			else
			{
				userinfo = this._userinfo;
			}
			return userinfo;
		}
	}
	protected ChinaCity m_City
	{
		get
		{
			ChinaCity city;
			if (this._city == null)
			{
				this._city = new ChinaCity(this.conn);
				city = this._city;
			}
			else
			{
				city = this._city;
			}
			return city;
		}
	}
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(5))
		{
			base.WriteLog("Modidy", Language.GetAdminMsg("Log/Access", "0"), "User");
			base.WriteRightErrMsg();
		}
		if (!base.admin.CheckAdminPower(5))
		{
			this.UserDetailButton.Enabled = false;
		}
		if (this.UserID == 0)
		{
			this.WriteErrMsg("", Language.GetAdminMsg("Common/LostParam", "UserID"), "");
		}
		if (!base.IsPostBack)
		{
			this.CreateTime.Attributes.Add("onfocus", string.Concat(new string[]
			{
				"show_cele_date(",
				this.CreateTime.UniqueID,
				",'','',",
				this.CreateTime.UniqueID,
				");"
			}));
			this.UpdateTime.Attributes.Add("onfocus", string.Concat(new string[]
			{
				"show_cele_date(",
				this.UpdateTime.UniqueID,
				",'','',",
				this.UpdateTime.UniqueID,
				");"
			}));
			this.Birthday.Attributes.Add("onfocus", string.Concat(new string[]
			{
				"show_cele_date(",
				this.Birthday.UniqueID,
				",'','',",
				this.Birthday.UniqueID,
				");"
			}));
			this.rblMarriage.bindDataToRadioButtonList("HL_ClientContacter", "Marriage", true);
			this.BindForm();
		}
	}
	protected void BindForm()
	{
		DataTable userInfoByUserID = this.m_UserInfo.GetUserInfoByUserID(this.UserID);
		if (userInfoByUserID.Rows.Count == 0)
		{
			string userNameByID = this.m_UserInfo.GetUserNameByID(this.UserID);
			if (userNameByID == null)
			{
				this.WriteErrMsg("", Language.GetAdminMsg("Common/NotData"), "");
			}
			this.UserIDBox.Text = this.UserID.ToString();
			this.UserNameBox.Text = userNameByID;
			this.UserDetailButton.Visible = false;
		}
		else
		{
			DataRow dataRow = userInfoByUserID.Rows[0];
			this.UserIDBox.Text = this.UserID.ToString();
			this.UserNameBox.Text = dataRow["UserName"].ToString();
			this.TrueName.Text = dataRow["TrueName"].ToString();
			this.ComeFrom.Text = dataRow["ComeFrom"].ToString();
			this.Birthday.Text = dataRow["Birthday"].ToString();
			this.Nation.Text = dataRow["Nation"].ToString();
			this.IDCard.Text = dataRow["IDCard"].ToString();
			this.rblMarriage.rblSelect(dataRow["Marriage"].ToString().Trim());
			this.Eductation.Text = dataRow["Eductation"].ToString();
			this.GraduteSchool.Text = dataRow["GraduteSchool"].ToString();
			this.Family.Text = dataRow["Family"].ToString();
			this.CreateTime.Text = dataRow["CreateTime"].ToString();
			this.UpdateTime.Text = dataRow["UpdateTime"].ToString();
			this.intro.Text = dataRow["intro"].ToString();
			this.Interests.Text = dataRow["Interests"].ToString();
			this.InCome.Text = dataRow["InCome"].ToString();
			this.ZipCode.Text = dataRow["ZipCode"].ToString();
			this.HomePhone.Text = dataRow["HomePhone"].ToString();
			this.Mobile.Text = dataRow["MobilePhone"].ToString();
			this.OICQ.Text = dataRow["OICQ"].ToString();
			this.ICQ.Text = dataRow["ICQ"].ToString();
			this.MSN.Text = dataRow["MSN"].ToString();
			this.HomePage.Text = dataRow["HomePage"].ToString();
			this.Fax.Text = dataRow["Fax"].ToString();
			this.Taobaowangwang.Text = dataRow["Taobaowangwang"].ToString();
			this.CompanyName.Text = dataRow["CompanyName"].ToString();
			this.BuyCrediet.Text = dataRow["BuyCrediet"].ToString();
			this.SaleCrediet.Text = dataRow["SaleCrediet"].ToString();
			this.ShopID.Text = dataRow["ShopID"].ToString();
			if (dataRow["UserID"].ToString() == "")
			{
				this.UserDetailButton.Visible = false;
			}
		}
	}
	protected void UpDate_OnClick(object sender, CommandEventArgs e)
	{
		string text = this.TrueName.Text;
		string text2 = this.ComeFrom.Text;
		string text3 = this.Nation.Text;
		string text4 = this.IDCard.Text;
		int marriage = Convert.ToInt32(this.rblMarriage.SelectedValue);
		string text5 = this.Eductation.Text;
		string text6 = this.GraduteSchool.Text;
		string text7 = this.Family.Text;
		DateTime createTime;
		if (this.CreateTime.Text == "")
		{
			createTime = DateTime.Now;
		}
		else
		{
			createTime = Convert.ToDateTime(this.CreateTime.Text);
		}
		DateTime updateTime;
		if (this.UpdateTime.Text == "")
		{
			updateTime = DateTime.Now;
		}
		else
		{
			updateTime = Convert.ToDateTime(this.UpdateTime.Text);
		}
		DateTime birthday;
		if (this.Birthday.Text == "")
		{
			birthday = DateTime.Now;
		}
		else
		{
			birthday = Convert.ToDateTime(this.Birthday.Text);
		}
		string text8 = this.intro.Text;
		string text9 = this.InCome.Text;
		string text10 = this.Interests.Text;
		string country = "";
		string province = "";
		string city = "";
		string text11 = this.ZipCode.Text;
		string text12 = this.HomePhone.Text;
		string address = "";
		string text13 = this.Mobile.Text;
		string text14 = this.OICQ.Text;
		string text15 = this.ICQ.Text;
		string text16 = this.MSN.Text;
		string text17 = this.Fax.Text;
		string text18 = this.HomePage.Text;
		string text19 = this.Taobaowangwang.Text;
		string text20 = this.CompanyName.Text;
		int buyCrediet;
		try
		{
			buyCrediet = Convert.ToInt32(this.BuyCrediet.Text);
		}
		catch
		{
			buyCrediet = 0;
		}
		int saleCrediet;
		try
		{
			saleCrediet = Convert.ToInt32(this.SaleCrediet.Text);
		}
		catch
		{
			saleCrediet = 0;
		}
		int shopID;
		try
		{
			shopID = Convert.ToInt32(this.ShopID.Text);
		}
		catch
		{
			shopID = 0;
		}
		if (!(e.CommandName.ToString().ToLower() == "add"))
		{
			if (e.CommandName.ToString().ToLower() == "edit")
			{
				this.m_UserInfo.UpdateUserInfoByUserID(text, text4, province, city, birthday, text2, country, text5, text7, text17, text6, text18, text9, text8, text10, marriage, text3, address, text11, text14, text16, text19, text13, text12, text15, text20, createTime, updateTime, buyCrediet, saleCrediet, shopID, this.UserID);
			}
		}
		base.WriteLog("Modify", Language.GetAdminMsg("Log/ObjectID", this.UserID.ToString()), "UserInfor");
		this.WriteSuccessMsg("", Language.GetAdminMsg("Common/EditSuccess"), "Admin_UserDetail.aspx?MenuName=&#x4F1A;&#x5458;&FileName=&#x7528;&#x6237;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&UserID=" + this.UserID);
	}
}
